﻿package {
	import br.com.network.ControleServerSocket;
	import br.com.network.events.ControleServerSocketEvent;
	import br.com.network.TiposBroadcast;
	import flash.display.Sprite;
	import flash.net.Socket;
	
	/**
	 * ...
	 * @author Ricardo Teixeira
	 */
	public class Principal extends Sprite {
		
		public function Principal () {
			var serv:ControleServerSocket = new ControleServerSocket (6667, TiposBroadcast.OBJECT);
			serv.addEventListener (ControleServerSocketEvent.CONECTADO, onConectado);
			serv.addEventListener (ControleServerSocketEvent.ESCUTANDO, onEscutando);
			serv.addEventListener (ControleServerSocketEvent.ERRO, onErro);
			serv.addEventListener (ControleServerSocketEvent.DESCONECTADO, onDesconectado);
			serv.iniciar ();
		}
		
		private function onErro(e:ControleServerSocketEvent):void {
			trace ("onErro");
		}
		
		private function onEscutando(e:ControleServerSocketEvent):void {
			trace ("onEscutando"); 
		}
		
		private function onDesconectado(e:ControleServerSocketEvent):void {
			trace ("onDesconectado");
		}
		
		private function onConectado(e:ControleServerSocketEvent):void {
			trace ("onConectado");
		}
		
	}
	
}